home *** CD-ROM | disk | FTP | other *** search
Makefile | 1995-09-30 | 6.4 KB | 239 lines |
- # Copyright (c) 1993, 1994, 1995
- # The Regents of the University of California. All rights reserved.
- #
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that: (1) source code distributions
- # retain the above copyright notice and this paragraph in its entirety, (2)
- # distributions including binary code include the above copyright notice and
- # this paragraph in its entirety in the documentation or other materials
- # provided with the distribution, and (3) all advertising materials mentioning
- # features or use of this software display the following acknowledgement:
- # ``This product includes software developed by the University of California,
- # Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
- # the University nor the names of its contributors may be used to endorse
- # or promote products derived from this software without specific prior
- # written permission.
- # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- #
- # @(#) $Header: Makefile.in,v 1.37+ 94/06/25 14:53:47 leres Exp $ (LBL)
-
- #
- # Various configurable paths
- #
- # where the installed pcap files go
- INCL_DIR = /usr/local/include
- # where libpcap.a should go
- LIB_DIR = /usr/local/lib
- # where man page should go
- MAN_DIR = /usr/local/man
- #
- # Owner of installed files
- #
- BIN_GRP = bin
- BIN_OWN = bin
-
- #
- # You shouldn't need to edit anything below.
- #
-
- #have-ethers#ETHERS_DEFINES = -DETHER_SERVICE
-
- #have-sunos5#OS_DEFINES = -DSOLARIS
-
- DEFINE_STDC = -D__STDC__
- #have-gcc#DEFINE_STDC =
- #have-irix4#OS_DEFINES = -Dvolatile= $(DEFINE_STDC)
- #have-irix5#OS_DEFINES = -Dvolatile= $(DEFINE_STDC)
-
- #have-pf#PCAP_DEFINES = -DPCAP_PF
-
- #have-bpf#PCAP = bpf
- #have-dlpi#PCAP = dlpi
- #have-nit#PCAP = nit
- #have-pf#PCAP = pf
- #have-snit#PCAP = snit
- #have-snoop#PCAP = snoop
- #have-linux#PCAP = linux
-
- CCOPT = -O
- INCLUDES = -I.
- #have-linux#INCLUDES = -I. -Ilinux-include
- DEFINES = -DFDDI $(ETHERS_DEFINES) $(PCAP_DEFINES) $(OS_DEFINES)
-
- # Standard CFLAGS
- CFLAGS = $(CCOPT) $(DEFINES) $(INCLUDES)
-
- # Standard C compiler
- CC = cc
- GCC_FLAGS = -Wmissing-prototypes -Wstrict-prototypes
- #have-gcc1#GCC_FLAGS =
- #have-gcc#CC = gcc -g -Wall $(GCC_FLAGS)
-
- #
- # Flex and bison allow you to specify the prefixes of the global symbols
- # used by the generated parser. This allows programs to use lex/yacc
- # and link against libpcap. If you don't have flex or bison, get them.
- #
- LEX = lex
- YACC = yacc
- #have-flex#LEX = flex -Ppcap_
- #have-bison#YACC = bison -y -p pcap_
-
- MAKE = make
- SHELL = /bin/sh
-
- RANLIB = true
- #have-ranlib#RANLIB = ranlib
-
- # Explicitly define compiliation rule since SunOS 4's make doesn't like gcc.
- # Also, gcc does not remove the .o before forking 'as', which can be a
- # problem if you don't own the file but can write to the directory.
- .c.o:
- rm -f $@; $(CC) $(CFLAGS) -c $*.c
-
- PCAPSRC = \
- pcap-$(PCAP).c
- CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c savefile.c \
- bpf_filter.c bpf_image.c
- LSRC = scanner.l
- YSRC = grammar.y
- GENSRC = \
- $(LSRC:.l=.c) $(YSRC:.y=.c)
-
- SRC = $(PCAPSRC) $(CSRC) $(GENSRC)
- ALLSRC = \
- pcap-bpf.c pcap-dlpi.c pcap-enet.c pcap-nit.c pcap-pf.c \
- pcap-snit.c pcap-snoop.c \
- $(CSRC) checkioctl.c $(LSRC) $(YSRC)
-
- OBJ = $(SRC:.c=.o)
- # Some makes can't handle the above substitution
- #have-broken-make#OBJ = pcap-$(PCAP).o \
- #have-broken-make# pcap.o inet.o gencode.o optimize.o nametoaddr.o \
- #have-broken-make# etherent.o savefile.o bpf_filter.o bpf_image.o \
- #have-broken-make# scanner.o grammar.o
-
- HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
- ethertype.h gencode.h
- GENHDR = \
- tokdefs.h
-
- TAGFILES = \
- $(SRC) $(HDR)
-
- TARFILES = \
- README CHANGES INSTALL VERSION Makefile.in pcap.3 mkdep \
- $(ALLSRC) $(HDR) \
- net bpf/net/bpf_filter.c bpf/net/bpf.h SUNOS4 configure
-
- CLEANFILES = \
- $(OBJ) libpcap.a checkioctl lex.yy.c $(GENSRC) $(GENHDR)
-
- libpcap.a: $(OBJ)
- rm -f libpcap.a
- ar rc $@ $(OBJ)
- $(RANLIB) $@
-
- checkioctl: checkioctl.c
- rm -f $@; $(CC) $(CFLAGS) $@.c -o $@
-
- scanner.c: scanner.l
- rm -f $@; $(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
-
- scanner.o: scanner.c tokdefs.h
- rm -f $@; $(CC) $(CFLAGS) $(LEX_DEFINES) -c $*.c
-
- tokdefs.h: grammar.c
- grammar.c: grammar.y
- rm -f grammar.c tokdefs.h
- $(YACC) -d $<
- mv y.tab.c grammar.c
- mv y.tab.h tokdefs.h
-
- grammar.o: grammar.c
- $(CC) -c $(CFLAGS) -Dyylval=pcap_lval grammar.c
-
- install: force
- @for i in $(INCL_DIR) $(LIB_DIR) ; do \
- if [ ! -d $$i ] ; then \
- echo "mkdir $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- chown $(BIN_OWN) $$i; \
- chgrp $(BIN_GRP) $$i; \
- else \
- true; \
- fi; \
- done
- cp libpcap.a $(LIB_DIR); \
- chmod 444 $(LIB_DIR)/libpcap.a; \
- chown $(BIN_OWN) $(LIB_DIR)/libpcap.a; \
- chgrp $(BIN_GRP) $(LIB_DIR)/libpcap.a
- -$(RANLIB) $(LIB_DIR)/libpcap.a
- cp pcap.h pcap-namedb.h $(INCL_DIR); \
- chmod 444 $(INCL_DIR)/pcap.h $(INCL_DIR)/pcap-namedb.h; \
- chown $(BIN_OWN) $(INCL_DIR)/pcap.h $(INCL_DIR)/pcap-namedb.h; \
- chgrp $(BIN_GRP) $(INCL_DIR)/pcap.h $(INCL_DIR)/pcap-namedb.h
- @if [ ! -f /usr/include/net/bpf.h ]; then \
- i=$(INCL_DIR)/net; \
- if [ ! -d $$i ] ; then \
- echo "mkdir $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- chown $(BIN_OWN) $$i; \
- chgrp $(BIN_GRP) $$i; \
- else \
- true; \
- fi; \
- set -x; \
- cp net/bpf.h $(INCL_DIR)/net; \
- chmod 444 $(INCL_DIR)/net/bpf.h; \
- chown $(BIN_OWN) $(INCL_DIR)/net/bpf.h; \
- chgrp $(BIN_GRP) $(INCL_DIR)/net/bpf.h; \
- fi
-
- install-man: force
- @i=$(MAN_DIR)/man3; \
- if [ ! -d $$i ] ; then \
- echo "mkdir $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- chown $(BIN_OWN) $$i; \
- chgrp $(BIN_GRP) $$i; \
- else \
- true; \
- fi; \
- cp pcap.3 $(MAN_DIR)/man3
- chmod 444 $(MAN_DIR)/man3/pcap.3
- chown $(BIN_OWN) $(MAN_DIR)/man3/pcap.3
- chgrp $(BIN_GRP) $(MAN_DIR)/man3/pcap.3
-
- clean:
- rm -f $(CLEANFILES)
-
- realclean:
- rm -f $(CLEANFILES) Makefile tags
-
- tags: $(TAGFILES)
- ctags -wtd $(TAGFILES)
-
- tar: force
- @cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
- list="" ; tar="tar cFFf" ; \
- for i in $(TARFILES) ; do list="$$list $$name/$$i" ; done; \
- echo \
- "rm -f ../$$name; ln -s $$dir ../$$name" ; \
- rm -f ../$$name; ln -s $$dir ../$$name ; \
- echo \
- "(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
- (cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
- echo \
- "rm -f ../$$name" ; \
- rm -f ../$$name
-
- force: /tmp
- depend: $(GENSRC) force
- ./mkdep -c $(CC) $(DEFINES) $(INCLUDES) $(SRC)
-